const { Schema, SchemaTypes } = require('../schema');

/**
 * 用户推广收入
 */
class PromoteIncome extends Schema {
    PropertyModelDataTemplate () {
        return {
            // 订单id
            orderId: { type: SchemaTypes.ObjectId, required: true },
            // 订单实际支付价格
            price: { type: SchemaTypes.Number, required: true },
            // 分销类型
            promoteType: { type: SchemaTypes.Number, required: true },
            // 分销数值
            promoteValue: { type: SchemaTypes.Number, required: true },
            // 分销收入
            promoteAmount: { type: SchemaTypes.Number, required: true },
            // 收入状态
            status: { type: SchemaTypes.Number, required: true },

            // 推广员id
            promoterId: { type: SchemaTypes.ObjectId, required: true },
            // 客户id
            customId: { type: SchemaTypes.ObjectId, required: true },

            settlementTime: { type: SchemaTypes.Number, required: false },
            // 区域id
            areaId: { type: SchemaTypes.ObjectId, required: true },
            createTime: { type: SchemaTypes.Number, required: true, default: require('../../module/tool/time').getCurrentTimestamp() }
        };
    }
}

module.exports = PromoteIncome;
